package office;

public class MyDate implements Comparable<MyDate> {
	int year;
	int month;
	int day;
	int hour;
	int minute;
	int second;

	public MyDate(int year, int month, int day, int hours, int minute,
			int second) {
		this.year = year;
		this.month = month;
		this.day = day;
		this.hour = hours;
		this.minute = minute;
		this.second = second;
	}

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public int getMonth() {
		return month;
	}

	public void setMonth(int month) {
		this.month = month;
	}

	public int getDay() {
		return day;
	}

	public void setDay(int day) {
		this.day = day;
	}

	public int getHours() {
		return hour;
	}

	public void setHours(int hours) {
		this.hour = hours;
	}

	public int getMinute() {
		return minute;
	}

	public void setMinute(int minute) {
		this.minute = minute;
	}

	public int getSecond() {
		return second;
	}

	public void setSecond(int second) {
		this.second = second;
	}

	@Override
	public String toString() {
		return year + "/" + month + "/" + day + " - " + hour + ":" + minute
				+ ":" + second;
	}

	@Override
	public int compareTo(MyDate that) {

		if (this.year != that.year) {
			return this.year - that.year;
		}

		if (this.month != that.month) {
			return this.month - that.month;
		}

		if (this.day != that.day) {
			return this.day - that.day;
		}

		if (this.hour != that.hour) {
			return this.hour - that.hour;
		}

		if (this.minute != that.minute) {
			return this.minute - that.minute;
		}

		if (this.second != that.second) {
			return this.second - that.second;
		}

		return 0;
	}

}
